import { useEffect, useState } from "react"
import { fromJS } from 'immutable';

// const immutableObj = fromJS({
//     a: {
//         b: 1
//     }
// })
// const newState = immutableObj.get('a').set('b', 2);
// const newState = immutableObj.setIn(['a', 'b'], 2);

export default function Dong3() {
    const [state, setState] = useState(fromJS({
        a: {
            b: 1
        }
    }))

    useEffect(() => {
        setTimeout(() => {
            setState(state.setIn(['a', 'b'], 2));
        }, 1000)
    }, [])
    return (
        <div>
            我是Dong3组件{state.getIn(['a', 'b'])}
        </div>
    )
}
